package top.hcode.hoj.pojo.vo.coll;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author orangej
 * @since 2025/1/26
 */
@Data
@ApiModel(value = "学生成绩详情")
public class ItechCollStudentScoreDetailVO {
    @ApiModelProperty(value = "活动id")
    private String collId;

    @ApiModelProperty(value = "学生id")
    private String userId;

    @ApiModelProperty(value = "客观题得分")
    private BigDecimal objectiveScore;

    @ApiModelProperty(value = "主观题得分")
    private BigDecimal subjectiveScore;

    @ApiModelProperty(value = "总得分")
    private BigDecimal totalScore;

    @ApiModelProperty(value = "学生姓名")
    private String userName;

    @ApiModelProperty(value = "账号")
    private String account;

    @ApiModelProperty(value = "班级id")
    private String classId;

    @ApiModelProperty(value = "班级名称")
    private String className;

    @ApiModelProperty(value = "学校名称")
    private String schoolName;

    @ApiModelProperty(value = "评分状态")
    private Integer judgeState;

    @ApiModelProperty(value = "开始答题时间")
    private Date startAnswerAt;

    @ApiModelProperty(value = "提交时间")
    private Date submitAt;

    @ApiModelProperty(value = "答题时长")
    public int getUsedMinutes() {
        if (startAnswerAt == null || submitAt == null) {
            return 0;
        }
        return (int) ((submitAt.getTime() - startAnswerAt.getTime()) / (1000 * 60));
    }
}
